package com.sense.kukoo.common.media.net

import com.sense.kukoo.common.repo.bean.BookDetailsBean
import com.sense.kukoo.common.repo.bean.BookItemBean
import com.sense.kukoo.common.repo.bean.QueryPageBean
import com.sense.kukoo.common.repo.bean.ResultBean
import okhttp3.RequestBody
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Path

interface MediaHttpApi {

    //默认携带40条章节数据,若想继续加载则需调整分页起始位置(eg: pageSize = 20, pageIndex = 3 (40 / 20 + 1))
    /**详情*/
    @GET("/api/book/details/{id}")
    suspend fun bookDetails(@Path("id") id: String): ResultBean<BookDetailsBean>

    /**新增-收听*/
    @POST("/api/user/listen/save")
    suspend fun listen(@Body requestBody: RequestBody): ResultBean<Boolean>

    /**详情页-分页查询*/
    @POST("/api/book/item/query-page")
    suspend fun bookQueryPage(@Body requestBody: RequestBody): ResultBean<QueryPageBean<BookItemBean>>

    /**是否订阅*/
    @GET("/api/user/subscription/is-subscription/{bookId}")
    suspend fun isSubscription(@Path("bookId") bookId: String): ResultBean<Boolean>

    /**切换-订阅/未订阅 订阅记录*/
    @POST("/api/user/subscription/sub/{bookId}")
    suspend fun subscription(@Path("bookId") bookId: String): ResultBean<Boolean>

    /**是否点赞*/
    @GET("/api/user/like/is-like/{bookId}/{bookItemId}")
    suspend fun isLike(@Path("bookId") bookId: String, @Path("bookItemId") bookItemId: String): ResultBean<Boolean>

    /**点赞-取消*/
    @POST("/api/user/like/{bookId}/{bookItemId}")
    suspend fun like(@Path("bookId") bookId: String, @Path("bookItemId") bookItemId: String): ResultBean<Boolean>
}